<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>共享米宝管理后台 - 分润设置</title>
    <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.15.12/lib/theme-chalk/index.css">
    <link rel="stylesheet" href="../assets/css/custom.css">
</head>
<body class="bg-gray-100">
    <div class="admin-container flex">
        <!-- Sidebar -->
        <div class="w-64 bg-gray-800 min-h-screen flex-shrink-0">
            <div class="p-4 text-white">
                <div class="flex items-center mb-6">
                    <i class="fas fa-bolt mr-2 text-yellow-400"></i>
                    <span class="text-lg font-medium">共享米宝管理系统</span>
                </div>
                
                <nav>
                    <a href="index.html" class="block py-2 px-4 rounded hover:bg-gray-700 mb-1">
                        <i class="fas fa-chart-line mr-2"></i> 控制台
                    </a>
                    <a href="users.html" class="block py-2 px-4 rounded hover:bg-gray-700 mb-1">
                        <i class="fas fa-users mr-2"></i> 用户管理
                    </a>
                    <a href="investors.html" class="block py-2 px-4 rounded hover:bg-gray-700 mb-1">
                        <i class="fas fa-user-tie mr-2"></i> 投资人管理
                    </a>
                    <a href="devices.html" class="block py-2 px-4 rounded hover:bg-gray-700 mb-1">
                        <i class="fas fa-battery-full mr-2"></i> 设备管理
                    </a>
                    <a href="revenue.html" class="block py-2 px-4 rounded hover:bg-gray-700 mb-1">
                        <i class="fas fa-money-bill-wave mr-2"></i> 收益管理
                    </a>
                    <a href="commission-settings.html" class="block py-2 px-4 rounded bg-gray-700 mb-1">
                        <i class="fas fa-cog mr-2"></i> 分润设置
                    </a>
                </nav>
            </div>
        </div>

        <!-- Main content -->
        <div class="flex-grow">
            <!-- Header -->
            <header class="bg-white shadow-sm">
                <div class="container mx-auto px-4 py-3 flex justify-between items-center">
                    <h1 class="text-xl font-medium">分润设置</h1>
                    <div class="flex items-center">
                        <span class="mr-4">管理员</span>
                        <img class="h-8 w-8 rounded-full" src="https://via.placeholder.com/40" alt="管理员头像">
                    </div>
                </div>
            </header>

            <!-- Page content -->
            <main class="container mx-auto p-4">
                <!-- Default Commission Settings -->
                <div class="bg-white rounded-lg shadow-sm p-6 mb-6">
                    <div class="flex justify-between items-center mb-6">
                        <h2 class="text-lg font-medium">默认分润配置</h2>
                        <button class="bg-blue-500 text-white px-4 py-2 rounded-md text-sm" id="edit-default-btn">
                            编辑配置
                        </button>
                    </div>

                    <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
                        <!-- Investor Commission -->
                        <div class="bg-gray-50 rounded-lg p-5 border border-gray-200">
                            <div class="flex items-center mb-4">
                                <div class="bg-green-100 p-3 rounded-full mr-3">
                                    <i class="fas fa-user-tie text-green-500"></i>
                                </div>
                                <h3 class="text-lg font-medium">投资人分润</h3>
                            </div>
                            <div class="space-y-3">
                                <div class="flex justify-between">
                                    <span class="text-gray-600">分润比例</span>
                                    <span class="font-medium">20%</span>
                                </div>
                            </div>
                        </div>
                        
                        <!-- Referral Commission -->
                        <div class="bg-gray-50 rounded-lg p-5 border border-gray-200">
                            <div class="flex items-center mb-4">
                                <div class="bg-blue-100 p-3 rounded-full mr-3">
                                    <i class="fas fa-share-alt text-blue-500"></i>
                                </div>
                                <h3 class="text-lg font-medium">推荐分润</h3>
                            </div>
                            <div class="space-y-3">
                                <div class="flex justify-between">
                                    <span class="text-gray-600">推荐分佣</span>
                                    <span class="font-medium">2%</span>
                                </div>
                            </div>
                        </div>
                        
                        <!-- Recruiter Commission -->
                        <div class="bg-gray-50 rounded-lg p-5 border border-gray-200">
                            <div class="flex items-center mb-4">
                                <div class="bg-purple-100 p-3 rounded-full mr-3">
                                    <i class="fas fa-user-plus text-purple-500"></i>
                                </div>
                                <h3 class="text-lg font-medium">招商分润</h3>
                            </div>
                            <div class="space-y-3">
                                <div class="flex justify-between">
                                    <span class="text-gray-600">招商分佣</span>
                                    <span class="font-medium">5%</span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Commission History -->
                <div class="bg-white rounded-lg shadow-sm p-6">
                    <div class="flex justify-between items-center mb-6">
                        <h2 class="text-lg font-medium">配置修改历史</h2>
                    </div>

                    <div class="overflow-x-auto">
                        <table class="min-w-full divide-y divide-gray-200">
                            <thead>
                                <tr>
                                    <th class="px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">修改日期</th>
                                    <th class="px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">操作管理员</th>
                                    <th class="px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">修改类型</th>
                                    <th class="px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">修改内容</th>
                                </tr>
                            </thead>
                            <tbody class="bg-white divide-y divide-gray-200">
                                <tr>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm">2023-04-15 14:23</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm">admin@example.com</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm">
                                        <span class="px-2 py-1 text-xs rounded-full bg-blue-100 text-blue-700">默认配置</span>
                                    </td>
                                    <td class="px-6 py-4 text-sm">
                                        投资人分润: 15% → 20%
                                    </td>
                                </tr>

                                <tr>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm">2023-03-10 09:45</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm">admin@example.com</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm">
                                        <span class="px-2 py-1 text-xs rounded-full bg-blue-100 text-blue-700">默认配置</span>
                                    </td>
                                    <td class="px-6 py-4 text-sm">
                                        推荐分佣: 2% → 2%
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>

                <!-- Edit Default Modal -->
                <div id="edit-default-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden">
                    <div class="bg-white rounded-lg p-6 max-w-md w-full">
                        <div class="flex justify-between items-center mb-4">
                            <h3 class="text-lg font-medium">编辑默认分润配置</h3>
                            <button class="text-gray-500" id="close-modal-btn">
                                <i class="fas fa-times"></i>
                            </button>
                        </div>
                        
                        <div class="space-y-4">
                            <h4 class="font-medium">投资人分润</h4>
                            <div>
                                <label class="block text-sm text-gray-600 mb-1">分润比例 (%)</label>
                                <input type="number" min="0" max="100" value="20" class="w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500">
                            </div>
                            
                            <h4 class="font-medium pt-2">推荐分润</h4>
                            <div>
                                <label class="block text-sm text-gray-600 mb-1">推荐分佣 (%)</label>
                                <input type="number" min="0" max="100" value="2" class="w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500">
                            </div>
                            
                            <h4 class="font-medium pt-2">招商分润</h4>
                            <div>
                                <label class="block text-sm text-gray-600 mb-1">招商分佣 (%)</label>
                                <input type="number" min="0" max="100" value="5" class="w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500">
                            </div>
                            
                            <div class="flex justify-end space-x-2 pt-4">
                                <button class="px-4 py-2 border border-gray-300 rounded-md text-sm" id="cancel-btn">
                                    取消
                                </button>
                                <button class="px-4 py-2 bg-blue-500 text-white rounded-md text-sm" id="save-btn">
                                    保存
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </main>
        </div>
    </div>

    <!-- JavaScript for functionality -->
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // Modal handling
            const editDefaultBtn = document.getElementById('edit-default-btn');
            const editDefaultModal = document.getElementById('edit-default-modal');
            const closeModalBtn = document.getElementById('close-modal-btn');
            const cancelBtn = document.getElementById('cancel-btn');
            const saveBtn = document.getElementById('save-btn');
            
            // Show modal
            editDefaultBtn.addEventListener('click', function() {
                editDefaultModal.classList.remove('hidden');
            });
            
            // Hide modal functions
            function hideModal() {
                editDefaultModal.classList.add('hidden');
            }
            
            closeModalBtn.addEventListener('click', hideModal);
            cancelBtn.addEventListener('click', hideModal);
            
            // Handle save button
            saveBtn.addEventListener('click', function() {
                console.log('Saving commission settings...');
                hideModal();
                // Show success notification
                alert('分润配置已更新！');
            });
        });
    </script>
</body>
</html> 